from rest_framework import serializers
from demo_class.models import BookInfo


# class BookSerializers(serializers.ModelSerializer):
#     class Meta:
#         model = BookInfo
#         fields = '__all__'

class HeroSerializer(serializers.Serializer):
    hname = serializers.CharField()
    hcomment = serializers.CharField()
    # hbook=serializers.PrimaryKeyRelatedField(read_only=True)
    # hbook = BookSerializer()

class BookSerializer(serializers.Serializer):
    btitle = serializers.CharField(max_length=20, min_length=5)
    bpub_date = serializers.DateField()
    bread = serializers.IntegerField()
    # is_delete = serializers.BooleanField()
    heroinfo_set=HeroSerializer(many=True)



# from DRF.serializers import BookSerializer,HeroSerializer

# from demo_class.models import BookInfo,HeroInfo
